package org.lagou.edu;

import org.lagou.edu.logSdk.utils.OperationLogUtils;
import org.lagou.edu.pojo.Config;
import org.lagou.edu.pojo.SubConfig1;
import org.lagou.edu.pojo.SubConfig2;
import org.lagou.edu.service.ConfigService;
import org.lagou.edu.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages = {"org.lagou.edu", "org.lagou.edu.logSdk"})    // 加入sdk的包扫描，让sdk中的的bean能够放入到IoC容器中
public class Main2 {


    public static void main(String[] args) throws IllegalAccessException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(Main.class, args);

        ConfigService configService = applicationContext.getBean(ConfigService.class);


        Config config1 = new Config(
                new SubConfig1("aaa", 1, "bbb"),
                new SubConfig2("ccc", 2, "ddd")
        );

        Config config2 = new Config(
                new SubConfig1("aaa", 1, "bbb2"),
                new SubConfig2("ccc", 2, "ddd")
        );

        configService.changeConfig(config1, config2);


    }
}
